Two-way Finite Automaton
   HOME

TheInfoList



OR:

In
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
, in particular in
automata theory Automata theory is the study of abstract machines and automata, as well as the computational problems that can be solved using them. It is a theory in theoretical computer science. The word ''automata'' comes from the Greek word αὐτόματο ...
, a two-way finite automaton is a
finite automaton A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number o ...
that is allowed to re-read its input.


Two-way deterministic finite automaton

A two-way deterministic finite automaton (2DFA) is an
abstract machine An abstract machine is a computer science theoretical model that allows for a detailed and precise analysis of how a computer system functions. It is analogous to a mathematical function in that it receives inputs and produces outputs based on pre ...
, a generalized version of the
deterministic finite automaton In the theory of computation, a branch of theoretical computer science, a deterministic finite automaton (DFA)—also known as deterministic finite acceptor (DFA), deterministic finite-state machine (DFSM), or deterministic finite-state automa ...
(DFA) which can revisit characters already processed. As in a DFA, there are a finite number of states with transitions between them based on the current character, but each transition is also labelled with a value indicating whether the machine will move its position in the input to the left, right, or stay at the same position. Equivalently, 2DFAs can be seen as read-only Turing machines with no work tape, only a read-only input tape. 2DFAs were introduced in a seminal 1959 paper by
Rabin Rabin is a List of Jewish surnames, Hebrew surname. It originates from the Hebrew word ''rav'' meaning Rabbi, or from the name of the specific Rabbi Abin I, Abin. The most well known bearer of the name was Yitzhak Rabin, prime minister of Israel ...
and Scott, who proved them to have equivalent power to one-way DFAs. That is, any
formal language In logic, mathematics, computer science, and linguistics, a formal language consists of words whose letters are taken from an alphabet and are well-formed according to a specific set of rules. The alphabet of a formal language consists of symb ...
which can be recognized by a 2DFA can be recognized by a DFA which only examines and consumes each character in order. Since DFAs are obviously a special case of 2DFAs, this implies that both kinds of machines recognize precisely the class of
regular language In theoretical computer science and formal language theory, a regular language (also called a rational language) is a formal language that can be defined by a regular expression, in the strict sense in theoretical computer science (as opposed to ...
s. However, the equivalent DFA for a 2DFA may require exponentially many states, making 2DFAs a much more practical representation for algorithms for some common problems. 2DFAs are also equivalent to read-only Turing machines that use only a constant amount of space on their work tape, since any constant amount of information can be incorporated into the finite control state via a product construction (a state for each combination of work tape state and control state).


Formal description

Formally, a two-way deterministic finite automaton can be described by the following 8-
tuple In mathematics, a tuple is a finite ordered list (sequence) of elements. An -tuple is a sequence (or ordered list) of elements, where is a non-negative integer. There is only one 0-tuple, referred to as ''the empty tuple''. An -tuple is defi ...
: M=(Q,\Sigma,L,R,\delta,s,t,r) where * Q is the finite, non-empty set of ''states'' * \Sigma is the finite, non-empty set of input symbols * L is the left endmarker * R is the right endmarker * \delta: Q \times (\Sigma \cup \) \rightarrow Q \times \ * s is the start state * t is the end state * r is the reject state In addition, the following two conditions must also be satisfied: * For all q \in Q :\delta(q,L)=(q^\prime,\mathrm) for some q^\prime \in Q :\delta(q,R)=(q^\prime,\mathrm) for some q^\prime \in Q It says that there must be some transition possible when the pointer reaches either end of the input word. * For all symbols \sigma \in \Sigma \cup \ : \delta(t,\sigma)=(t,R) : \delta(r,\sigma)=(r,R) : \delta(t,R)=(t,L) : \delta(r,R)=(r,L) It says that once the automaton reaches the accept or reject state, it stays in there forever and the pointer goes to the right most symbol and cycles there infinitely.


Two-way nondeterministic finite automaton

A two-way nondeterministic finite automaton (2NFA) may have multiple transitions defined in the same configuration. Its transition function is * \delta: Q \times (\Sigma \cup \) \rightarrow 2^. Like a standard one-way NFA, a 2NFA accepts a string if at least one of the possible computations is accepting. Like the 2DFAs, the 2NFAs also accept only regular languages.


Two-way alternating finite automaton

A two-way alternating finite automaton (2AFA) is a two-way extension of an
alternating finite automaton In automata theory, an alternating finite automaton (AFA) is a nondeterministic finite automaton whose transitions are divided into ''existential'' and ''universal'' transitions. For example, let ''A'' be an alternating automaton. * For an existenti ...
(AFA). Its state set is * Q=Q_\exists \cup Q_\forall where Q_\exists \cap Q_\forall=\emptyset. States in Q_\exists and Q_\forall are called ''existential'' resp. ''universal''. In an existential state a 2AFA nondeterministically chooses the next state like an NFA, and accepts if at least one of the resulting computations accepts. In a universal state 2AFA moves to all next states, and accepts if all the resulting computations accept.


State complexity tradeoffs

Two-way and one-way finite automata, deterministic and nondeterministic and alternating, accept the same class of regular languages. However, transforming an automaton of one type to an equivalent automaton of another type incurs a blow-up in the number of states. Christos Kapoutsis determined that transforming an n-state 2DFA to an equivalent DFA requires n(n^n-(n-1)^n) states in the worst case. If an n-state 2DFA or a 2NFA is transformed to an NFA, the worst-case number of states required is \binom = O\left(\frac\right). Ladner,
Lipton Lipton is a British brand of tea, owned by Ekaterra. Lipton was also a supermarket chain in the United Kingdom, later sold to Argyll Foods, after which the company sold only tea. The company is named after its founder, Sir Thomas Lipton, who fo ...
and Stockmeyer. proved that an n-state 2AFA can be converted to a DFA with 2^ states. The 2AFA to NFA conversion requires 2^ states in the worst case, see Geffert and Okhotin. It is an open problem whether every 2NFA can be converted to a 2DFA with only a polynomial increase in the number of states. The problem was raised by Sakoda and Sipser, who compared it to the P vs. NP problem in the
computational complexity theory In theoretical computer science and mathematics, computational complexity theory focuses on classifying computational problems according to their resource usage, and relating these classes to each other. A computational problem is a task solved by ...
. Berman and Lingas discovered a formal relation between this problem and the L vs. NL open problem, see Kapoutsis for a precise relation.


Sweeping automata

Sweeping automata are 2DFAs of a special kind that process the input string by making alternating left-to-right and right-to-left sweeps, turning only at the endmarkers. Sipser constructed a sequence of languages, each accepted by an n-state NFA, yet which is not accepted by any sweeping automata with fewer than 2^n states.


Two-way quantum finite automaton

The concept of 2DFAs was in 1997 generalized to
quantum computing Quantum computing is a type of computation whose operations can harness the phenomena of quantum mechanics, such as superposition, interference, and entanglement. Devices that perform quantum computations are known as quantum computers. Though ...
by John Watrous's "On the Power of 2-Way Quantum Finite State Automata", in which he demonstrates that these machines can recognize nonregular languages and so are more powerful than DFAs.


Two-way pushdown automaton

A
pushdown automaton In the theory of computation, a branch of theoretical computer science, a pushdown automaton (PDA) is a type of automaton that employs a stack. Pushdown automata are used in theories about what can be computed by machines. They are more capa ...
that is allowed to move either way on its input tape is called two-way pushdown automaton (2PDA); it has been studied by Hartmanis, Lewis, and Stearns (1965). Aho, Hopcroft, Ullman (1968) and Cook (1971) characterized the class of languages recognizable by deterministic (2DPDA) and non-deterministic (2NPDA) two-way pushdown automata; Gray, Harrison, and Ibarra (1967) investigated the closure properties of these languages.


References

{{reflist Finite automata